import { useLocation, useParams, useSearchParams,useNavigate } from 'react-router-dom'
function WithRoute(MyComponent) {
    function NewComponent(props) {
        let params = useParams();
        let search = useSearchParams();
        let location = useLocation();
        let navigate = useNavigate();
        return <MyComponent router={{
            params:params,
            search:search,
            location:location,
            navigate:navigate
        }} {...props}></MyComponent>
    }
    return  NewComponent;
}

export default WithRoute;